import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

/**
 * service 导入历史
 * @since 2019-10-10
 */
import request from 'utils/request';
import { CPAAS_IMP } from 'utils/config';
import { getCurrentOrganizationId } from 'utils/utils';
var organizationId = getCurrentOrganizationId();
/**
 * 模板头数据查询接口
 * @async
 * @function loadTemplate
 * @param {Object} params - 查询参数
 * @param {String} params.code - 模板编码
 */

export function loadTemplate(_x) {
  return _loadTemplate.apply(this, arguments);
}

function _loadTemplate() {
  _loadTemplate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    var prefixPatch, code, reqUrl;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            prefixPatch = params.prefixPatch, code = params.code;
            reqUrl = prefixPatch ? "".concat(prefixPatch, "/v1/").concat(organizationId, "/import/template/").concat(code, "/info") : "".concat(CPAAS_IMP, "/v1/").concat(organizationId, "/template/").concat(code, "/info");
            return _context.abrupt("return", request(reqUrl, {
              method: 'GET'
            }));

          case 3:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _loadTemplate.apply(this, arguments);
}